const mysql = require("mysql");

function conn2mysql() {

    const IPADDRESS = '124.220.108.105'
    const PORTS = 3306
    const UserName = 'sa'
    const PWD = 'rice'
    const DBName = 'chuanganqidata'

    const connection = mysql.createConnection({
        host: IPADDRESS,
        port: PORTS,
        user: UserName,
        password: PWD,
        database: DBName
    });

    connection.connect(err => {
        if (err) {
            console.log(err)
            throw err;
        }
        console.log('Successfully connected to the database.');
    });
    return connection;
}

module.exports = conn2mysql;